﻿--HEADER SecurityView Modifications
--SKIPTRANSACTION
ALTER VIEW [TradingData].[SecurityView]
WITH SCHEMABINDING 
AS
SELECT        Extent1.Id, Extent1.Name, Extent1.Ric, Extent1.LongName, Extent1.ParentId, Extent1.Isin, Extent1.Ticker, Extent2.Name AS Class, Extent3.EconomicSectorDescription AS Sector, 
                         Extent4.CountryDescription AS Country, Extent5.Name AS Currency
FROM            TradingData.[Security] AS Extent1 INNER JOIN
                         TradingData.SecurityClass AS Extent2 ON Extent1.ClassId = Extent2.Id INNER JOIN
                         TradingData.EconomicSector AS Extent3 ON Extent1.EconomicSectorId = Extent3.Id INNER JOIN
                         TradingData.Country AS Extent4 ON Extent1.CountryId = Extent4.Id INNER JOIN
                         TradingData.Currency AS Extent5 ON Extent1.CurrencyId = Extent5.Id
GO
CREATE UNIQUE CLUSTERED INDEX [SecurityViewIndex]
    ON [TradingData].[SecurityView]([Id] ASC);
GO
CREATE FULLTEXT INDEX ON [TradingData].[SecurityView]
    ([Name] LANGUAGE 1033, [Ric] LANGUAGE 1033, [LongName] LANGUAGE 1033, [Isin] LANGUAGE 1033, 
	[Class] LANGUAGE 1033, [Sector] LANGUAGE 1033, [Country] LANGUAGE 1033, [Currency] LANGUAGE 1033,
	[Ticker] LANGUAGE 1033)
    KEY INDEX [SecurityViewIndex]
    ON [IIP];

GO
alter fulltext index on [TradingData].[SecurityView]
SET STOPLIST = OFF
